package com.zjc.app.api.sdk.client;

import com.google.gson.reflect.TypeToken;
import com.zjc.app.api.sdk.dto.ResultDto;
import com.zjc.app.api.sdk.dto.request.ApiSellLogSyncDTO;
import com.zjc.app.api.sdk.dto.result.ApiDeviceAccDataResultDTO;
import com.zjc.app.api.sdk.dto.result.ApiSellLogSyncErrorDTO;
import com.zjc.app.api.sdk.exception.AppBizRuntimeException;

import java.io.IOException;
import java.util.List;

/**
 * 土方销售数据同步接口
 */
public class TuFangSellLogClient extends BaseClient {

    public TuFangSellLogClient(String serverUrl, String appId, String appSecret, Integer connectTimeout, Integer readTimeout) {
        super(serverUrl, appId, appSecret, connectTimeout, readTimeout);
    }

    public ResultDto<List<ApiSellLogSyncErrorDTO>> syncSellLog(List<ApiSellLogSyncDTO> requests) throws IOException, AppBizRuntimeException {
        String url = "/v1/tu_fang/sell_log/sync";
        return super.doPost(url, requests, new TypeToken<ResultDto<List<ApiSellLogSyncErrorDTO>>>() {});
    }

    public ResultDto<List<ApiDeviceAccDataResultDTO>> getAccWorkTimesAndAccRunTimes(List<String> requests) throws IOException, AppBizRuntimeException {
        String url = "/v1/device/getAccData";
        return super.doPost(url, requests, new TypeToken<ResultDto<List<ApiDeviceAccDataResultDTO>>>() {});
    }
}
